package org.dev.hi.item

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.layout_activity_hi_item.*
import org.dev.hi.R
import org.dev.hi.hiui.item.HiAdapter
import org.dev.hi.hiui.item.HiDataItem
import org.devio.`as`.hi.hiitem.hiitem.ImageDataItem
import org.devio.`as`.hi.hiitem.hiitem.ItemTabDataItem
import org.devio.`as`.hi.hiitem.hiitem.VideoDataItem
import org.sean.hiitem.ActivityDataItem

/**
 * Author WenPing
 * CreateTime 2021/4/22.
 * Description:
 */
class HiItemActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.layout_activity_hi_item)


        var hiAdapter = HiAdapter(this)

        recycler_view.layoutManager = GridLayoutManager(this, 2)
        recycler_view.adapter = hiAdapter;

        var dataSets: ArrayList<HiDataItem<*, out RecyclerView.ViewHolder>> = ArrayList()
        dataSets.add(TopTabDataItem(ItemData()))
        dataSets.add(TopBanner(ItemData()))
        dataSets.add(GridDataItem(ItemData()))
        dataSets.add(ActivityDataItem(ItemData()))//活动区域
        dataSets.add(ItemTabDataItem(ItemData()))//商品tab栏

        for (i in 0..9) {
            if (i % 2 == 0) {
                //feeds流的视频类型
                dataSets.add(VideoDataItem(1, ItemData()))
            } else {
                //feeds流的图片类型
                dataSets.add(ImageDataItem(1, ItemData()))
            }
        }

        hiAdapter.additemsAt(dataSets, false)

    }
}